<template>
  <view v-if="shenheStatus == 0" class="withdraw">
    <view class="withdrawList">
      <view
        class="withdrawItem"
        v-for="(item, index) in orderList"
        :key="index"
      >
        <view class="info">
          <text>{{
            status == 0
              ? $t('shareholder.noGet')
              : status == 1
              ? $t('person.cashStatus4')
              : ''
          }}</text>
          <text>{{ item.created_at }}</text>
        </view>
        <text class="money">+{{ item.amount }}</text>
      </view>
    </view>
  </view>
  <Shenhe v-else-if="shenheStatus == 1"></Shenhe>
</template>

<script>
import Shenhe from '@/components/shenhe/shenhe';
export default {
  components: { Shenhe },
  data() {
    return {
      // 订单列表
      orderList: [],
      // 当前加载页面
      page: 1,
      // 是否加载完毕
      noMore: false,
      // 提现状态
      status: -1,
    };
  },
  methods: {
    // 获取订单列表
    async getOrders() {
      const res = await this.$allrequest.merchant.orderList(
        {
          page: this.page,
          status: this.status,
        },
        true
      );
      if (res.code == 0) {
        this.orderList = [...this.orderList, ...res.data.list];
        if (this.orderList.length >= res.data.row_count) {
          this.noMore = true;
        } else {
          this.noMore = false;
        }
      }
    },
  },
  onLoad(option) {
    this.status = option.status;
  },
  onShow() {
    this.orderList = [];
    this.page = 1;
    this.noMore = false;
    this.getOrders();
  },
  onReachBottom() {
    if (!this.noMore) {
      this.page++;
      this.getOrders();
    }
  },
};
</script>

<style lang="scss" scoped>
.withdraw {
  min-height: 100vh;
  background-color: #f2f2f2;
  font-family: PingFang SC;
  color: #262626;
  padding-top: 24rpx;
}
.header-tabs {
  width: 100%;
  padding-top: 20rpx;
  height: 90rpx;
  // line-height: 90rpx;
  background: #ffffff;
  position: fixed;
  top: 0;
  z-index: 1000;
  left: 0;
}
.withdrawList {
  margin-bottom: 24rpx;
  padding-left: 30rpx;
  background-color: #fff;
  .withdrawItem {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24rpx 30rpx 24rpx 0;
    border-bottom: 1px solid #f1f1f1;
    .info {
      display: flex;
      flex-direction: column;
      font-size: 28rpx;
      text:nth-child(2) {
        font-size: 24rpx;
        color: #8c8c8c;
        margin-top: 4rpx;
      }
    }
    .money {
      font-size: 36rpx;
      font-weight: 600;
    }
  }
  .withdrawItem:last-child {
    border-bottom: none;
  }
}
</style>
